package test;

import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class TengXun2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        int num = scanner.nextInt();
        System.out.println(getRes(str,num));
//        System.out.println(getRes1(str,num));
    }



    private static String getRes(String str, int num) {
        if (num < 1){
            return "";
        }
        Queue<String> queue = new PriorityQueue<>((o1, o2) -> {
            int length = o1.length();
            if (o1.length() < o2.length()){
                length = o2.length();
            }
            for (int i = 0; i < length; i++) {
                if (i < o1.length() && i < o2.length()){
                    if (o1.charAt(i) < o2.charAt(i)){
                        return 1;
                    }else if (o1.charAt(i) > o2.charAt(i)){
                        return -1;
                    }
                }else {
                    if (o1.length() <= i){
                        return 1;
                    }else {
                        return -1;
                    }
                }
            }
            return 1;
        });
        for (int i = 0; i < str.length(); i++) {
            for (int j = i + 1; j < str.length(); j++) {
                queue.add(str.substring(i,j + 1));
                if (queue.size() >= num){
                    queue.poll();
                }
            }
        }
        return queue.poll();
    }
    private static String getRes1(String str, int num) {
        if (num < 1){
            return "";
        }
        int count = 0;
        for (int i = 0; i < str.length(); i++) {
            for (int j = i + 1; j < str.length() + 1; j++) {
                count++;
                if (count == num){
                    return str.substring(i,j);
                }
            }
        }
        return "";
    }
}
